home *** CD-ROM | disk | FTP | other *** search
- package com.ibm.uvm.abt.edit;
-
- import java.beans.PropertyEditorSupport;
- import java.util.ResourceBundle;
-
- public class CharEditor extends PropertyEditorSupport {
- private static ResourceBundle resabtedit = ResourceBundle.getBundle("com/ibm/uvm/abt/edit/abtedit");
-
- public String getAsText() {
- if (((PropertyEditorSupport)this).getValue() == null) {
- return "";
- } else {
- Character v = (Character)((PropertyEditorSupport)this).getValue();
- return v.toString();
- }
- }
-
- public String getJavaInitializationString() {
- Character c = (Character)((PropertyEditorSupport)this).getValue();
- return c != '\\' && c != '\'' ? "'" + c + "'" : "'\\" + c + "'";
- }
-
- public void setAsText(String text) throws IllegalArgumentException {
- if (text.length() == 1) {
- ((PropertyEditorSupport)this).setValue(new Character(text.charAt(0)));
- } else {
- throw new IllegalArgumentException(resabtedit.getString("Invalid_property_value") + text + resabtedit.getString("entered_for_a_char"));
- }
- }
- }
-